#include "epollServer.hpp"
#include <memory>

using namespace std;
using namespace epoll_ns;

void Usage(char *proc)
{
    cout << "Usage: \n\t" << proc << "port"
         << "\n\n";
    exit(USAGE_ERR);
}
string echo(const string &response)
{
    return "[epoll_server#] " + response;
}
//./epoll_server port
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        Usage(argv[0]);
    }
    uint16_t port = atoi(argv[1]);
    unique_ptr<EpollServer> epollsvr(new EpollServer(echo, port));
    epollsvr->initServer();
    epollsvr->start();

    return 0;
}